﻿using Autofac;
using Loong.Dependency;
using Loong.Events.Bus.Handlers;
using Loong.Modules;
using MediatR;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Loong
{
    public sealed class ApplicationModule : Module, ILoongModule
    {
        public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
            services.AddMediatR(ThisAssembly);
        }

        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterAssemblyByConvention(ThisAssembly);
        }

        public void Initialize()
        {
            EventHandlerRegister.Register(ThisAssembly);
        }

        public void Shutdown()
        {
        }
    }
}
